package com.jiangyao.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@ApiModel(value = "成员动态Dto")
public class UserDynamicVo implements Comparable<UserDynamicVo> {
    @ApiModelProperty(value = "类型 1-职位 2-经历 3-学期课程 4-公开课课程")
    private Integer type;

    @ApiModelProperty(value = "关联的ID")
    private Integer relateId;

    @ApiModelProperty(value = "关联的名称")
    private String relateName;

    @ApiModelProperty(value = "关联时间",hidden = true)
    private Date relateTime;

    public UserDynamicVo(){

    }

    public UserDynamicVo(Integer type, Integer relateId, String relateName, Date relateTime) {
        this.type = type;
        this.relateId = relateId;
        this.relateName = relateName;
        this.relateTime = relateTime;
    }

    @Override
    public int compareTo(UserDynamicVo o) {
        if(relateTime==null || o.relateName==null){
            return -1;
        }
        if(relateTime.getTime() > o.relateTime.getTime()) {
            return 1;
        }
        if(relateTime.getTime() == o.relateTime.getTime()) {
            return 0;
        }
        return -1;
    }
}
